export function search(searchKey,arr,arrKey){
    let backInfo = []
    let keys = []
    let haveKey
    arr.forEach(item =>{
        keys = Object.keys(item)
        haveKey = keys.some(item =>{
            return item = arrKey
        })
    })
    if(searchKey == ''){
        return backInfo
    }else if(Object.prototype.toString.call(arr) != '[object Array]' || arr.length == 0 || arrKey == ''|| !haveKey){
       return 'error'
    }else {
        arr.map(item =>{
            if(item[arrKey].search(searchKey)!=-1){
                backInfo.push(item)
            }
        })
        return backInfo
    }
}